<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 * $Id: 2017-12-13 03:39:35 apple $
*/
defined('BY_JYA') or exit('error');
cfc('core')->checklogin();
$_RQ['op']=$_RQ['op']?$_RQ['op']:'get';
$return=array();
if($_RQ['op']=='get'){
	$member=model('core/member')->detail($_SESSION['uid'],array('credit1','credit2','credit3','credit4','credit5','credit6','mobile','avatar','username','nickname'));
	$item=pdo_get('jy_huiqi365_log',array('uniacid'=>$_SESSION['uniacid'],'mid'=>$_SESSION['uid']));
	$item['nickname']=$$member['nickname']?:$member['username'];
	$tips='请提交真实姓名，身份证号码！以备顺利完成实名签约！';
	$return['item']=$item;
	$return['tips']=$tips;
	set_html('title','实名签约');
	exi($return);
}
if($_RQ['op']=='post'){
	$postdata=get_postdata();
	$postdata['ordersn']='SN'.get_ordersn($this->tablename('log'),'ordersn');
	if(!$postdata['realname'] || !$postdata['cardnum'] || !$postdata['mobile'] || !$postdata['cardimg1'] || !$postdata['cardimg2']){
		exi('姓名，身份证号，手机号，身份正反面必填！','error');
	}
	$postdata['id']=$this->model('model')->addlog($postdata);
	$res=$this->model('api')->checkinfo($postdata);
	$postdata['passed']=$res['businessStatus']?2:1;
	$this->pdo_update('log',array('passed'=>$postdata['passed']),array('uniacid'=>$_SESSION['uniacid'],'id'=>$postdata['id']));
	exi('提交成功！','',$_SESSION['forward_url']);
}